<?php
// ☭☭☭☭☭☭☭☭☭☭☭☭☭☭☭
header("Content-Type:text/html;charset=UTF-8");
/**
 * 显示变量,stripslashes
 *
 * @param mixed $value 需显示的变量, 字符串 or 数字
 * @param bool $escape 是否转义
 */
function _e($value, $escape=true){
    if($escape and is_string($value) ){
        echo htmlspecialchars($value, ENT_QUOTES);
    }else{
        echo $value;
    }
}//END func _e 


if (isset($_POST['start'])){
	system("date >> start.txt");
	system("sh startone.sh >> start.txt");
 }

 
 
 echo 'time = ',date('Y-m-d H:m:s'), ' AND timestamp = ', strtotime( date('Y-m-d H:m:s') );
 
?>

<form action="test020.php" method="post">
  <input type="text" name="text" />
  
  <input type="submit" name="start" value="start" />
  
  
</form>


<?php 

preg_match('/([0-9]{3})\..*/', $_SERVER['SERVER_ADDR'], $matches);
var_dump($matches);


//测试PDO的字符转义
$sql = "select * from test222 where object_id > ";
$add = ' 0\' DELETE FROM `tbl_rooms_homecycleimg` ';

$pdo = new PDO('mysql:dbname=test;host=127.0.0.1');
$sql .= $pdo->quote($add);
echo '<br/>',stripslashes($sql),'<br/>';
try {
	$q = $pdo->query( $sql );
	if( is_object($q) ){
		var_dump( $q->fetchAll() );
	}else{
		echo 'Error: not a obj';
	}
}catch(Exception $e){
	echo $e->__toString();
}

$str = $_POST['text']; //'dsadsadasdas \\ dsadsad\\ ; \'\'\' dasdasda djoasjdoi的';
$str2 = $pdo->quote($str);

echo '<hr/>', $_POST['text'] ,'<br/>' ,$str ,'<br/>', $str2, '<br/>', _e($str2);


?>